﻿@model ASC.Models.ChannelModel
@using ASC.Resources;
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<table style="width: 570px">
    <tr>
        <td class="centerAlign">
            <table class="maxWidth">
                <tr>
                    <td class="centerAlign">
                        <h2>@Global.FrmChannelAdd</h2>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table>
                <tr>
                    <td class="rightAlign" style="width: 100px">
                        @Channel.ChannelName:
                    </td>
                    <td class="leftAlign">
                        <span class="valueLable">@Model.Channel.Name</span>
                    </td>
                    <td class="rightAlign">
                        @Channel.No:
                    </td>
                    <td class="leftAlign">
                        <span class="valueLable">-1</span>
                    </td>
                    <td class="rightAlign" style="width: 100px">
                        @Channel.Type:
                    </td>
                    <td>
                        <span class="valueLable">@Model.Channel.ChannelType.Description</span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table>
                <tr>
                    <td class="rightAlign" style="width: 100px">
                        @Channel.Description:
                    </td>
                    <td class="leftAlign">
                        <span class="valueLable">@Model.Channel.Description</span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table>
                <tr>
                    <td>@Html.CheckBoxFor(m => m.Channel.SaveStat, new { disabled = "disabled" })
                    </td>
                    <td style="width: 130px">@Channel.StoringStatistic
                    </td>
                    <td>@Html.CheckBoxFor(m => m.Channel.Sign, new { disabled = "disabled" })
                    </td>
                    <td style="width: 80px">@Channel.Remark
                    </td>
                    <td class="rightAlign" style="width: 100px">@Channel.Transformation:
                    </td>
                    <td>
                        <span class="valueLable">
                            @switch (Model.Channel.Transtype)
                            {
                                case 1:
                                    { <text>A/D conversion</text>}
                                    break;
                                case 2:
                                    { <text>Peeling</text>}
                                    break;
                                case 3:
                                    { <text>Pulse/value-conversion</text>}
                                    break;
                            }
                        </span>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <table>
                <tr>
                    <td>@Channel.ConnectTo:
                    </td>
                    <td>
                        <select name="" style="width: 140px;" disabled = "disabled">
                            <option value="0"></option>
                        </select>
                    </td>
                    <td class="rightAlign" style="width: 80px">@Channel.SamplingInterval
                    </td>
                    <td>
                        <span class="valueLable">
                            @Model.Channel.Interval
                        </span>
                    </td>
                    <td style="width: 25px">@Channel.Sec
                    </td>
                    <td>
                        <table cellspacing="0" cellpadding="0">
                            <tr>
                                <td>@Channel.Factor:
                                </td>
                                <td>
                                    <span class="valueLable">@Model.Channel.Factor</span>
                                </td>
                            </tr>
                            <tr>
                                <td>@Channel.Offset:
                                </td>
                                <td>
                                    <span class="valueLable">@Model.Channel.Offset</span>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <fieldset id="address" style="width: 560px">
                <legend>@Channel.IO_Adress</legend>
                <table>
                    <tr>
                        <td style="width: 80px">@Channel.WordLength
                        </td>
                        <td style="width: 80px">@Channel.Driver
                        </td>
                        <td style="width: 80px">@Channel.Loop
                        </td>
                        <td style="width: 80px">@Channel.Unit
                        </td>
                        <td style="width: 80px">@Channel.SubUnit
                        </td>
                        <td style="width: 80px">@Channel.Word
                        </td>
                        <td style="width: 80px">@Channel.Bit
                        </td>
                        <td style="width: 80px">@Channel.Inverted
                        </td>
                        <td style="width: 80px">@Channel.Async
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span class="valueLable">
                             @switch (Model.Channel.ChannelAddress.WordLength)
                             {
                                 case 0:
                                     { <text>4</text>}
                                     break;
                                 case 1:
                                     { <text>8</text>}
                                     break;
                                 case 2:
                                     { <text>16</text>}
                                     break;
                                 case 3:
                                     { <text>32</text>}
                                     break;
                             }
                             </span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @switch (Model.Channel.ChannelAddress.Drive)
                                {
                                    case 0:
                                        { <text>Test</text>}
                                        break;
                                    case 1:
                                        { <text>Siox</text>}
                                        break;
                                    case 2:
                                        { <text>PLCinPC</text>}
                                        break;
                                    case 3:
                                        { <text>Profibus</text>}
                                        break;
                                    case 4:
                                        { <text>DDE</text>}
                                        break;
                                    case 5:
                                        { <text>Backhoff</text>}
                                        break;
                                    case 6:
                                        { <text>ADSBackhoff</text>}
                                        break;
                                    case 7:
                                        { <text>ADSBeSR</text>}
                                        break;
                                    case 8:
                                        { <text>OPC_Beijer</text>}
                                        break;
                                    case 9:
                                        { <text>SQLDriver</text>}
                                        break;
                                    case 10:
                                        { <text>FileDriver</text>}
                                        break;
                                    case 11:
                                        { <text>FileDriverB1</text>}
                                        break;
                                }</span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @Model.Channel.ChannelAddress.Port</span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @Model.Channel.ChannelAddress.Unit</span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @Model.Channel.ChannelAddress.Subunit</span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @Model.Channel.ChannelAddress.AddressByte</span>
                        </td>
                        <td>
                            <span class="valueLable">
                                @Model.Channel.ChannelAddress.AddressBit</span>
                        </td>
                        <td>
                            <span class="valueLable">@Html.CheckBoxFor(m => m.Channel.ChannelAddress.Inverted, new { disabled = "disabled" })</span>
                        </td>
                        <td>@Html.CheckBoxFor(m => m.Channel.ChannelAddress.AsyncType, new { disabled = "disabled" })
                        </td>
                    </tr>
                </table>
            </fieldset>
        </td>
    </tr>
    <tr>
        <td>
            <fieldset style="width: 560px">
                <table>
                    <tr>
                        <td style="width: 140px" class="centerAlign">
                            @Channel.AvailableChannels
                        </td>
                        <td style="width: 140px">
                            <input type="radio" name="mean" disabled="disabled" />&nbsp;@Channel.Mean
                        </td>
                        <td colspan="2" class="centerAlign">
                            @Channel.SelectedChannels
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <input type="radio" name="Sum" disabled="disabled" checked="checked" />&nbsp;@Channel.Sum
                        </td>
                        <td style="width: 140px" class="centerAlign">
                            @Channel.Plus
                        </td>
                        <td style="width: 140px" class="centerAlign">
                            @Channel.Minus
                        </td>
                    </tr>
                    <tr>
                        <td>
                            @Html.ListBox("AvailableChannels", new SelectList(Model.AvailableChannels, "Channel_Id", "Name"), new { disabled = "disabled", style = "height:150px; width:130px;overflow:auto;" })
                        </td>
                        <td>
                        </td>
                        <td>
                            @Html.ListBox("PlusChannels", new SelectList(Model.PlusChannels, "Channel_Id", "Name"), new { disabled = "disabled", style = "height:150px; width:130px;overflow:auto" })
                        </td>
                        <td>
                            @Html.ListBox("MinusChannels", new SelectList(Model.MinusChannels, "Channel_Id", "Name"), new { disabled = "disabled", style = "height:150px; width:130px;overflow:auto" })
                        </td>
                    </tr>
                </table>
            </fieldset>
        </td>
    </tr>
    <tr>
        <td>
            <table class="maxWidth">
                <tr>
                    <td style="text-align:center">
                        <input type="button" value="@Global.Edit" class="StandartButton" onclick="window.location.href='@Url.Action("Edit", "Channel", new { Id = Url.RequestContext.RouteData.Values["id"] })'"/>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
